package com.frogs.ucenter.v1.request;

import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.OpenPlatformEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class WechatUserInfoUpdateRequest extends Request{

	/**
	 * 
	 */
	private static final long serialVersionUID = 7534497279924430290L;

	private Integer subScribe;
	
	private String openId;
	
	private String nickName;
	
	private Integer sex;
	
	private String city;
	
	private String country;
	
	private String province;
	
	private String language;
	
	private String headImgUrl;
	
	private String subscribeTime;
	
	private String unsubscribeTime;
	
	private Date createTime;
	
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	private Date updateTime;
	
	private String receiver;
	
	private String receiveProvince;
	
	private String receiveCity;
	
	private String receiveArea;
	
	private String receiveDetailInfo;
	
	private String receiveTel;
	
	private String receiveZipcode;
	
	private String uyuyUserid;
	
	private String x;
	
	private String y;
	
	private String addrearea;
	
	private Integer userId;
	
	private Integer wxuserid;
	
	private String unionid;
	
	private Integer openPlatformId;
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.subScribe = requestInfo.getIntParameter(ApiUrlParamEnum.subScribe.getParamName(), 0);
		this.nickName = requestInfo.getParameter(ApiUrlParamEnum.nickName.getParamName(), "");
		this.sex = requestInfo.getIntParameter(ApiUrlParamEnum.sex.getParamName(), 0);
		this.city = requestInfo.getParameter(ApiUrlParamEnum.city.getParamName(), "");
		this.country = requestInfo.getParameter(ApiUrlParamEnum.country.getParamName(), "");
		this.province = requestInfo.getParameter(ApiUrlParamEnum.province.getParamName(), "");
		this.language = requestInfo.getParameter(ApiUrlParamEnum.language.getParamName(), "");
		this.headImgUrl = requestInfo.getParameter(ApiUrlParamEnum.headImageUrl.getParamName(), "");
		this.subscribeTime = requestInfo.getParameter(ApiUrlParamEnum.subscribeTime.getParamName(), "");
		this.unsubscribeTime = requestInfo.getParameter(ApiUrlParamEnum.unsubscribeTime.getParamName(), "");
		this.createTime = requestInfo.getDateParameter(ApiUrlParamEnum.createTime.getParamName(), "yyyy-MM-dd HH:mm:ss");
		this.updateTime = requestInfo.getDateParameter(ApiUrlParamEnum.updateTime.getParamName(), "yyyy-MM-dd HH:mm:ss");
		this.receiver = requestInfo.getParameter(ApiUrlParamEnum.receiver.getParamName(), "");
		this.receiveProvince = requestInfo.getParameter(ApiUrlParamEnum.receiveProvince.getParamName(), "");
		this.receiveCity = requestInfo.getParameter(ApiUrlParamEnum.receiveCity.getParamName(), "");
		this.receiveArea = requestInfo.getParameter(ApiUrlParamEnum.receiveArea.getParamName(), "");
		this.receiveDetailInfo = requestInfo.getParameter(ApiUrlParamEnum.receiveDetailInfo.getParamName(), "");
		this.receiveTel = requestInfo.getParameter(ApiUrlParamEnum.receiveTel.getParamName(), "");
		this.receiveZipcode = requestInfo.getParameter(ApiUrlParamEnum.postcode.getParamName(), "");
		this.uyuyUserid = requestInfo.getParameter(ApiUrlParamEnum.uyuyUserid.getParamName(), "");
		this.x = requestInfo.getParameter(ApiUrlParamEnum.x.getParamName(), "");
		this.y = requestInfo.getParameter(ApiUrlParamEnum.y.getParamName(), "");
		this.addrearea = requestInfo.getParameter(ApiUrlParamEnum.addrearea.getParamName(), "");
		this.openId = requestInfo.getParameter(ApiUrlParamEnum.openId.getParamName(), "");
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.wxuserid = requestInfo.getIntParameter(ApiUrlParamEnum.wxuserid.getParamName(), 0);
		this.openPlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.openPlatformId.getParamName(), OpenPlatformEnum.WECHAT_MALL.getId());
		this.unionid = requestInfo.getParameter(ApiUrlParamEnum.unionid.getParamName(), "");
		if (StringUtil.isEmpty(openId)) {
			throw new RequestIllegalException("error openId: " + openId);
		}
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}
	}

	public Integer getSubScribe() {
		return subScribe;
	}

	public void setSubScribe(Integer subScribe) {
		this.subScribe = subScribe;
	}

	public String getOpenId() {
		return openId;
	}

	public void setOpenId(String openId) {
		this.openId = openId;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getHeadImgUrl() {
		return headImgUrl;
	}

	public void setHeadImgUrl(String headImgUrl) {
		this.headImgUrl = headImgUrl;
	}

	public String getSubscribeTime() {
		return subscribeTime;
	}

	public void setSubscribeTime(String subscribeTime) {
		this.subscribeTime = subscribeTime;
	}

	public String getUnsubscribeTime() {
		return unsubscribeTime;
	}

	public void setUnsubscribeTime(String unsubscribeTime) {
		this.unsubscribeTime = unsubscribeTime;
	}

	public String getReceiver() {
		return receiver;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public String getReceiveProvince() {
		return receiveProvince;
	}

	public void setReceiveProvince(String receiveProvince) {
		this.receiveProvince = receiveProvince;
	}

	public String getReceiveCity() {
		return receiveCity;
	}

	public void setReceiveCity(String receiveCity) {
		this.receiveCity = receiveCity;
	}

	public String getReceiveArea() {
		return receiveArea;
	}

	public void setReceiveArea(String receiveArea) {
		this.receiveArea = receiveArea;
	}

	public String getReceiveDetailInfo() {
		return receiveDetailInfo;
	}

	public void setReceiveDetailInfo(String receiveDetailInfo) {
		this.receiveDetailInfo = receiveDetailInfo;
	}

	public String getReceiveZipcode() {
		return receiveZipcode;
	}

	public void setReceiveZipcode(String receiveZipcode) {
		this.receiveZipcode = receiveZipcode;
	}

	public String getUyuyUserid() {
		return uyuyUserid;
	}

	public void setUyuyUserid(String uyuyUserid) {
		this.uyuyUserid = uyuyUserid;
	}

	public String getX() {
		return x;
	}

	public void setX(String x) {
		this.x = x;
	}

	public String getY() {
		return y;
	}

	public void setY(String y) {
		this.y = y;
	}

	public String getAddrearea() {
		return addrearea;
	}

	public void setAddrearea(String addrearea) {
		this.addrearea = addrearea;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getReceiveTel() {
		return receiveTel;
	}

	public void setReceiveTel(String receiveTel) {
		this.receiveTel = receiveTel;
	}

	public Integer getWxuserid() {
		return wxuserid;
	}

	public void setWxuserid(Integer wxuserid) {
		this.wxuserid = wxuserid;
	}

	public Integer getOpenPlatformId() {
		return openPlatformId;
	}

	public void setOpenPlatformId(Integer openPlatformId) {
		this.openPlatformId = openPlatformId;
	}

	public String getUnionid() {
		return unionid;
	}

	public void setUnionid(String unionid) {
		this.unionid = unionid;
	}


}
